import Vue from 'vue'

import Cookies from 'js-cookie'
import 'echarts-gl'
import 'normalize.css/normalize.css' // a modern alternative to CSS resets

import Element from 'element-ui'
import './styles/element-variables.scss'
// import enLang from 'element-ui/lib/locale/lang/en'// 如果使用中文语言包请默认支持，无需额外引入，请删除该依赖

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log

import * as filters from './filters' // global filters

import moment from 'moment' // 时间组件
// 文件上传组件
import FileUpload from "@/components/FileUpload";
// 图片上传组件
import ImageUpload from "@/components/ImageUpload";
// 图片预览组件
import ImagePreview from "@/components/ImagePreview";
Vue.component("FileUpload", FileUpload);
Vue.component("ImageUpload", ImageUpload);
Vue.component("ImagePreview", ImagePreview);

Vue.filter('formatDate', function(value) {
  if (value) {
    if (value === '-') {
      return '-'
    } else {
      return moment(value).format('YYYY-MM-DD HH:mm:ss')
    }
  } else {
    return ''
  }
})

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
if (process.env.NODE_ENV === 'production') {
  const { mockXHR } = require('../mock')
  mockXHR()
}
// 流程设计
import designer from '@/views/lcsj/componentFlowPath/workflow/designer'
Vue.component('flowpathDesigner', designer)

import designer1 from '@/views/lcsj/componentFlowPathNew/workflow/designer'
Vue.component('flowpathDesignerNew', designer1)

Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
  // locale: enLang // 如果使用中文，无需设置，请删除
})

import VForm from 'vform-builds' // 引入VForm库
import 'element-ui/lib/theme-chalk/index.css' // 引入element-ui样式
import 'vform-builds/dist/VFormDesigner.css' // 引入VForm样式

Vue.use(VForm) // 全局注册VForm(同时注册了v-form-designer、v-form-render等组件)

// import VFormRender from 'vform-builds/dist/VFormRender.umd.min.js'  //引入VFormRender组件
import 'vform-builds/dist/VFormRender.css' // 引入VFormRender样式

// Vue.use(VFormRender)  //全局注册VFormRender等组件

// register global utility filters
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})
import plugins from "./plugins"; // plugins
Vue.use(plugins);
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
